import numpy as np

import cv2

img = np.zeros((300,300,3),np.uint8)

pts = np.array([[50,50],[250,50],[250,250],[50,250]],np.int32)
#自动转换成2行1列
pts = pts.reshape((-1,2,1))
#实心多边形
#cv2.fillPoly(img,[pts],(0,255,0),cv2.LINE_AA)
#空心多边形              是否闭合
cv2.polylines(img,[pts],False,(0,255,0),6,cv2.LINE_AA)

cv2.imshow("img",img)

cv2.waitKey(0)

cv2.destroyAllWindows()
